﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PoliAsis.Domain
{
    public class Validator
    {
        int counter = 1;
        private Dictionary<int,string> validation_list;
        public Validator()
        {
            validation_list = new Dictionary<int, string>();
        }

        public void Add(string message)
        {
            validation_list.Add(counter,message);
            counter++;
        }

        public bool IsValid
        {
            get {  return (validation_list.Count == 0); }
        }

        public string GetValidationMessage() 
        {
            StringBuilder sb = new StringBuilder();
            foreach (int key in validation_list.Keys)
            {
                sb.Append(key + ". " + validation_list[key] + "<br />");
            }
            return sb.ToString();
        }
    }
}
